package com.jumper.study.admin.dto.resp;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;

public class StudentStudyLogResp {
    private Long id;

    private Long accountId;

    private String studentName;

    private Long lessonId;

    private Long chapterId;

    private String chapterTitle;

    private LocalDateTime enterTime;

    private LocalDateTime leaveTime;

    public StudentStudyLogResp() {
    }

    public StudentStudyLogResp(Long id, Long accountId, String studentName, Long lessonId, Long chapterId,
    String chapterTitle, LocalDateTime enterTime, LocalDateTime leaveTime) {
        this.id = id;
        this.accountId = accountId;
        this.studentName = studentName;
        this.lessonId = lessonId;
        this.chapterId = chapterId;
        this.chapterTitle = chapterTitle;
        this.enterTime = enterTime;
        this.leaveTime = leaveTime;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getAccountId() {
        return accountId;
    }

    public void setAccountId(Long accountId) {
        this.accountId = accountId;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public Long getLessonId() {
        return lessonId;
    }

    public void setLessonId(Long lessonId) {
        this.lessonId = lessonId;
    }

    public Long getChapterId() {
        return chapterId;
    }

    public void setChapterId(Long chapterId) {
        this.chapterId = chapterId;
    }

    public String getChapterTitle() {
        return chapterTitle;
    }

    public void setChapterTitle(String chapterTitle) {
        this.chapterTitle = chapterTitle;
    }

    public Long getStudyTimes() {
        return ChronoUnit.SECONDS.between(enterTime, leaveTime);
    }

    public Long getEnterTime() {
        return enterTime.toEpochSecond(ZoneOffset.UTC);
    }

    public void setEnterTime(LocalDateTime enterTime) {
        this.enterTime = enterTime;
    }

    public Long getLeaveTime() {
        return leaveTime.toEpochSecond(ZoneOffset.UTC);
    }

    public void setLeaveTime(LocalDateTime leaveTime) {
        this.leaveTime = leaveTime;
    }
}
